# uncompyle6 version 3.2.3
# Python bytecode 3.6 (3379)
# Decompiled from: Python 3.6.8 |Anaconda custom (64-bit)| (default, Feb 21 2019, 18:30:04) [MSC v.1916 64 bit (AMD64)]
# Embedded file name: helpers\issue_tracker\clients\util.py


def trim_trailing_character(word, char="/"):
    """Trim trailing characters in a string by a specified character
    
    By default this method will trim off any trailing forward-slashes ('/')
     unless specified otherwise.
    
    :Example:
    
    >>> word = 'https://jira.com////'
    >>> trim_trailing_character(word)
    >>> 'https://jira.com'
    
    >>> word = 'Foo???????'
    >>> char = '?'
    >>> trim_trailing_character(word, char)
    >>> 'Foo'
    
    >>> word = 'Foo???????'
    >>> trim_trailing_character(word)
    >>> 'Foo???????'
    
    :param word: String you want to trim
    :param char: Specified character you trim from the tail of a string.
                  This MUST be a single-character argument and will break
                  if you try to pass a string with length 2 or higher.
    :return: Trimmed string specified
    """
    if not len(char) == 1:
        raise AssertionError
    for _ in word:
        if word[-1] == char:
            word = word[:-1]

    if not not word.endswith(char):
        raise AssertionError
    return word


def evaluate_severity(severity):
    """Map Acunetix integer severity to a prettified severity string
    
    :param severity: Severity value to map against, must be between 0 and 4
    :return: Prettified severity string (e.g. 0 => Informational Alert)
    """
    if not 0 <= severity < 5:
        raise AssertionError
    severity_map = ["Informational Alert", "Low", "Medium", "High"]
    return severity_map[severity]
